<cfprocessingdirective suppresswhitespace="yes">
<!--- 
***** REVISION *****
10/18/06: This is a new tag
 --->	
<cfswitch expression="#thisTag.executionMode#">
	<cfcase value="start">
		<cfset tag = "form"/>

		<cfsavecontent variable="attributeCombination">
		<strong>Available Attributes are:</strong>
		<LI>Optional attributes: NAME, ID, ACTION, METHOD, ENCTYPE, DSN, LEGEND, CLASSLEGEND, CSS, BREAK, THEME, THEMEPATH,  SHOWBUTTONS, SHOWSUBMIT, SHOWCANCEL, SHOWRESET, SUBMIT, CANCEL, RESET, and CANCELURL.
		</cfsavecontent>
		
		<cfif structKeyExists(attributes,'man') or structKeyExists(attributes,'help')>
			<cfoutput><strong>#ucase(tag)# TAG</strong><br/>
			#attributeCombination#</cfoutput>
			<cfexit method="exittag"/>
		</cfif>

		<cfset excludes = "css,break,parent,theme,themePath,themeFile,libAbsPath,dsn,excludes,required,classRequired,showbuttons,showsubmit,showcancel,showreset,submit,cancel,reset,default,legend,classLegend,cancelURL"/>
		<cfinclude template="inc/functions.cfm"/>

		<cfset formtag = structNew()/>
		<cfset formtag.html = duplicate(attributes)/>		
		<cfset formtag.config = duplicate(attributes)/>
		<cfset config.fusebox = false/>

		<cfset config.index = listLast(cgi.SCRIPT_NAME,'/')/>		
		<cfparam name="config.cancelURL" default="#config.index#"/>
		
		<cfif structKeyExists(application, 'fusebox')>
			<cfset config.fusebox = true/>
		</cfif>
		
		<cfif config.fusebox>
			<cfinclude template="inc/fusebox.cfm"/>
		<cfelse>
			<cfinclude template="inc/nonframework.cfm"/>
		</cfif>

		<cfif structKeyExists(attributes, "id")>
			<cfset attributes.id=listLast(attributes.id,'.')/>			
		</cfif>		
		<cfparam name="attributes.id" default="#attributes.name#"/>
		<cfparam name="config.theme" default="default"/>
		<cfparam name="config.themePath" default="themes"/>
		<cfparam name="attributes.method" default="post"/>
		<cfparam name="attributes.style" default="margin:0px"/>
		<cfparam name="config.labelPosition" default="left"/>
		<cfparam name="config.break" default="true"/>
		<cfparam name="config.required" default="false"/>
		<cfparam name="config.classRequired" default="required"/>
		<cfparam name="config.css" default="true"/>
		<cfparam name="config.cssLabelCode" default="false"/>
				
		<cfparam name="config.showButtons" default="true"/>
		<cfparam name="config.showSubmit" default="true"/>
		<cfparam name="config.showCancel" default="true"/>
		<cfparam name="config.showReset" default="true"/>
		<cfparam name="config.submit" default="Submit"/>
		<cfparam name="config.cancel" default="Cancel"/>
		<cfparam name="config.reset" default="Reset"/>
		<cfparam name="config.radio.size" default="0"/>
		<cfparam name="config.checkbox.size" default="0"/>
		<cfparam name="config.button.count" default="0"/>
		
		<cfset config.cssCode=structNew()/>
		<cfset config.buttons = arrayNew(1)/>
		<cfset config.cancels = arrayNew(1)/>
		<cfset config.submits = arrayNew(1)/>
		
		<cfif structKeyExists(config,'excludes')>
			<cfset config.excludes = config.excludes & "," & excludes/>
		</cfif>
		<cfparam name="config.excludes" default="#excludes#"/>
	</cfcase>
	
	
	<cfcase value="end">
		<!--- Get Theme to display --->
		<cftry>
			<cfinclude template="#config.themePath#/#config.theme#/config.properties.cfm"/>
			<cfcatch type="missinginclude">
			</cfcatch>
		</cftry>
		<cfsavecontent variable="thisTag.generatedContent">
			<cftry>
				<cfinclude template="#config.themePath#/#config.theme#/#tag#.cfm"/>
				<cfcatch type="missinginclude">
					<cftry>
						<cfinclude template="themes/default/config.properties.cfm"/>					
						<cfinclude template="themes/default/#tag#.cfm"/>						
						<cfcatch type="missinginclude">
							<cfset showException(tag,'Your theme is missing. Make sure you specify the correct path.',2)/>						
						</cfcatch>
					</cftry>
				</cfcatch>
			</cftry>
		</cfsavecontent>
		<cfset thisTag.generatedContent = ReReplace(trim(thisTag.generatedContent), '(?m)^\s+\r\n','', "ALL")>
	</cfcase>
</cfswitch>
</cfprocessingdirective>